<template>
		<view class="page" style="background-color: #fff;">
	
			<cu-custom :isBack="true" textColor="#000000" bgColor="#fff">
				<block slot="backText"></block>
				<block slot="content">岗位详情</block>
			</cu-custom>
	
			<view class="all_jobs">
				<view class="jobs_item" style="margin-top: 0rpx;">
					<view>
						<view class="item_name_line">
							<text
								style="color: #000000;font-weight: bold;font-size: 33rpx;">{{newsDetail.zhaopindataGangwei}}</text>
						</view>
						<view class="item_some_line">
							<view class="item_wage" style="color: #3694EF;margin-top: 15rpx;">
								{{newsDetail.zhaopindataXinzi | filterXinzi}}
							</view>
						</view>
					</view>
					<view class="item_some_line location">
						<image class="" src="../../static/news/news_location.png"></image>
						<view class="item_wage"> {{ Diqu }} </view>
						<!-- <view class="item_wage"> {{ newsDetail.zhaopindataDiqu.replace(/,/g, ' ') }} </view> -->
					</view>
					<view class="split_line"></view>
					<view style="margin-bottom: 15rpx;" class="yaoqiu-all">
						<view class="yaoqiu">
							<image class="img-yaoqiu-1" src="../../static/news/news_Quanzhi.png" mode="aspectFill"
								style="width: 32rpx;height: 32rpx;"></image>
							<text class="txt-yaoqiu-1">{{newsDetail.zhaopindataIsQuanzhi | filterIsQuanzhi}}</text>
						</view>
						<view class="yaoqiu">
							<image class="img-yaoqiu-1" src="../../static/news/news_Renshu.png" mode="aspectFill"
								style="width: 32rpx;height: 32rpx;"></image>
							<text class="txt-yaoqiu-1">{{newsDetail.zhaopindataRenshu}}人</text>
						</view>
						<view class="yaoqiu">
							<image class="img-yaoqiu-1" src="../../static/news/news_Fuli.png" mode="aspectFill"
								style="width: 32rpx;height: 32rpx;"></image>
							<text class="txt-yaoqiu-1">五险一金</text>
						</view>
						<view class="yaoqiu">
							<image class="img-yaoqiu-1" src="../../static/news/news_Xueli.png" mode="aspectFill"
								style="width: 32rpx;height: 32rpx;"></image>
							<text class="txt-yaoqiu-1">{{newsDetail.zhaopindataXueli | filterXueli}}</text>
						</view>
						<view class="yaoqiu">
							<image class="img-yaoqiu-1" src="../../static/news/news_Jingyan.png" mode="aspectFill"
								style="width: 32rpx;height: 32rpx;"></image>
							<text class="txt-yaoqiu-1">{{newsDetail.zhaopindataJingyan | filterJingyan}}</text>
						</view>
						<view class="yaoqiu">
							<image class="img-yaoqiu-1" src="../../static/news/news_Nianling.png" mode="aspectFill"
								style="width: 32rpx;height: 32rpx;" v-show="this.newsDetail.zhaopindataAge"></image>
							<text class="txt-yaoqiu-1">{{newsDetail.zhaopindataAge | filterAge}}</text>
						</view>
					</view>
	
					<view class="split_line"></view>
	
					<view class="cdetail-all-wrap" style="width: 98%;">
						<view class="t_bar" style="top: 43rpx;"></view>
						<view class="content-title" style="color: #000000;margin-left: 0rpx;">职位描述</view>
						<view class="content-wrap">
							<rich-text class="content" :nodes="newsDetail.zhaopindataGangweiyaoqiu"></rich-text>
						</view>
					</view>
	
					<view class="split_line"></view>
	
					<view class="cdetail-all-wrap" style="width: 98%;">
						<!-- <view class="t_bar" style="top: 43rpx;"></view> -->
						<view class="content-title" style="color: #000000;margin-left: 0rpx;">公司信息</view>
						<view class="content-wrap">
							<view @click="viewNewsInfo(item.id)">
								<view class="item_name_line">
									<view class="item_name">{{newsDetail.zhaopindataQiye}}</view>
								</view>
								<view class="item_some_line">
									<view class="item_wage" style="font-size: 20rpx;">{{newsDetail.zhaopindataXingzhi}}
									</view>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
			<!-- 
			<view 
				v-if="isShowHide"
				style="width: 100%; position: fixed;bottom: 0; background-color: #FFFFFF;"
			>
				<uni-grid :column="1" :show-border="true" :square="false">
					<uni-grid-item >
						<view class="grid-item-box" style="padding: 10rpx 0rpx 0rpx 0rpx;">
							<image class="image" src="../../static/news/fenxiang.png" mode="aspectFill" style="width: 50rpx; height: 50rpx;"/>
							<button
								class="login-btn text-white" 
								style="background-color: #FFFFFF;color:#ff9292 ;font-weight: bold;border: none;" 
								type="default"
								open-type="share"
								size="mini">
								{{newsDetail.zhaopindataBeiyong2}}
							</button>
						</view>
					</uni-grid-item>
				</uni-grid>
			</view> -->
	
			<view class="flex-item-box bottom-content">
				<view class="bottom-view content1">
					<button open-type="share" class="bottom-button">
						<image class="image" src="../../static/news/news_share.png" mode="aspectFill"
							style="width: 50rpx; height: 50rpx;margin-top: 15rpx;" />
						<text class="text" style="color:#999;font-size: 24rpx; margin-top: 0px;">分享</text>
					</button>
				</view>
				<view class="bottom-view content1" @click="inputDialogToggle">
					<button class="bottom-button">
						<image class="image" src="../../static/news/news_phone.png" mode="aspectFill"
							style="width: 50rpx; height: 50rpx; margin-top: 15rpx;" />
						<text class="text" style="color:#999;font-size: 24rpx;margin-top: 0px; ">咨询</text>
					</button>
				</view>
				<view class="bottom-view content2" @click="viewToNewsBackinfo">
					<button @click="viewToNewsBackinfo" style="background: #3694EF;width:100%;color: #fff;">
						<text style="font-size: 28rpx;">立即报名</text>
					</button>
				</view>
			</view>
			
			<mpvue-city-picker :themeColor="themeColor" ref="mpvueCityPicker"
				:pickerValueDefault="cityPickerValueDefault" @onConfirm="onConfirm"></mpvue-city-picker>
		</view>
</template>
<script>
	import uniCol from '@/components/uni-ui/uni-row-col/uni-col/uni-col.vue';
	import uniRow from '@/components/uni-ui/uni-row-col/uni-row/uni-row.vue';
	import uniGrid from '@/components/uni-ui/uni-grid/uni-grid/uni-grid.vue';
	import uniGridItem from '@/components/uni-ui/uni-grid/uni-grid-item/uni-grid-item.vue';
	const app = getApp();
	export default {
		components: {
			uniCol,
			uniRow,
			uniGrid,
			uniGridItem,
		},
		
		data() {
			return {
				CustomBar: this.CustomBar,
				StatusBar: this.StatusBar,
				theme: app.globalData.theme.backgroundColor, //全局颜色变量
				newsDetail: {},
				isShowHide: true,
				lianluoyuanId: null,
				aboutPhone: null,
			}
		},
		computed: {
			Diqu:function() {
				if (JSON.stringify(this.newsDetail) === "{}")
					return ""
				else
					return this.newsDetail.zhaopindataDiqu.replace(/,/g, ' ')
			}
		},
		// 分享给朋友
		onShareAppMessage() {
			return {
				title: '岗位信息：' + this.newsDetail.zhaopindataGangwei,
				path: '/packageC/pages/news_detail/news_detail-fx?zhaopindata_id=' + this.newsDetail.zhaopindataId +
					'&lianluoyuan_id=' + app.globalData.userinfo.llyId,
				success() {
					uni.showToast({
						title: '分享成功'
					})
				},
				fail() {
					uni.showToast({
						title: '分享失败'
					})
				}
			}
		},
		// #ifdef MP-WEIXIN
		//分享到朋友圈
		onShareTimeline() {
			return {
				title: '岗位信息：' + this.newsDetail.zhaopindataGangwei,
				query: "fenxiang=fenxiang&zhaopindata_id=" + app.globalData.zhaopindata_id +
					"&lianluoyuan_id=" + app.globalData.userinfo.llyId +
					'&aboutPhone=' + app.globalData.aboutPhone,
				success() {
					uni.showToast({
						title: '分享成功'
					})
				},
				fail() {
					uni.showToast({
						title: '分享失败'
					})
				}
			}
		},
		// #endif
		filters: {
			filterAge(type) {
				switch (type) {
					case '0':
						return '18岁~25岁'
						break;
					case '1':
						return '26岁~30岁'
						break;
					case '2':
						return '31岁~35岁'
						break;
					case '3':
						return '36岁~40岁'
						break;
					case '4':
						return '41岁~50岁'
						break;
					case '5':
						return '50岁以上'
						break;
				}
			},
			filterXinzi(type) {
				switch (type) {
					case '0':
						return '面议'
						break;
					case '1':
						return '1000~1500/月'
						break;
					case '2':
						return '1500~2000/月'
						break;
					case '3':
						return '2000~3000/月'
						break;
					case '4':
						return '3000~5000/月'
						break;
					case '5':
						return '5000以上/月'
						break;
				}
			},
			filterJingyan(type) {
				switch (type) {
					case '0':
						return '无经验'
						break;
					case '1':
						return '1年以下'
						break;
					case '2':
						return '1~3年'
						break;
					case '3':
						return '3~5年'
						break;
					case '4':
						return '5年以上'
						break;
				}
			},
			filterXueli(type) {
				switch (type) {
					case '0':
						return '初中'
						break;
					case '1':
						return '高中'
						break;
					case '2':
						return '中技/中专'
						break;
					case '3':
						return '大专'
						break;
					case '4':
						return '本科'
						break;
					case '5':
						return '硕士'
						break;
				}
			},
			filterIsQuanzhi(type) {
				switch (type) {
					case '0':
						return '全职'
						break;
					case '1':
						return '兼职'
						break;
				}
			},
		},
		onLoad(option) {
			console.log(option, 'option')
			this.getNewsInfo(option.zhaopindata_id);
			this.lianluoyuanId = option.lianluoyuan_id;
			this.aboutPhone = option.aboutPhone;
			if (option.fenxiang == 'fenxiang') {
				this.isShowHide = false;
			} else {
				this.isShowHide = true;
			}

			// 分享
			wx.showShareMenu({
				withShareTicket: true,
				menus: ["shareAppMessage", "shareTimeline"]
			})

		},
		methods: {
			getNewsInfo(zhaopindataId) {
				uni.request({
					url: app.globalData.serve_job_url + zhaopindataId,
					method: 'GET',
					data: {},
					success: res => {
						this.newsDetail = res.data.data;
					},
				});
			},
			inputDialogToggle() {
				console.log(this.aboutPhone)
				uni.showModal({
					title: '咨询电话',
					content: this.aboutPhone,
					showCancel: false,
					confirmColor: '#3694EF',
					confirmText: '拨打电话',
					success: (res) => {
						if (res.confirm) {
							uni.makePhoneCall({
								phoneNumber: this.aboutPhone, // 手机号
								success: (res) => {
									console.log('调用成功!')
								},
								fail: (res) => {
									console.log('调用失败!')
								}
							});
						}
					}
				})
			},
			// 立即报名
			viewToNewsBackinfo() {
				uni.navigateTo({
					url: './news-backinfo-fx?zhaopindataId=' + this.newsDetail.zhaopindataId +
						'&zhaopindataGangwei=' + this.newsDetail.zhaopindataGangwei +
						'&lianluoyuanId=' + this.lianluoyuanId,
				});
			},
		}
	}
</script>
<style lang="scss">
	page {
		background-color: #fff;
		// padding-top: env(safe-area-inset-top);
	}
	.button {
		align-items: center;
		justify-content: center;
		flex: 1;
		height: 35px;
		margin: 0 5px;
		border-radius: 5px;
	}

	// .t_bar {
	// 	position: absolute;
	// 	left: 25rpx;
	// 	-webkit-transform: translate(0, -50%);
	// 	transform: translate(0, -50%);
	// 	width: 7rpx;
	// 	height: 30rpx;
	// 	background: #1787fb;
	// }
	.content-wrap {
		margin-top: 20rpx;
		margin-left: 0rpx !important;
	}

	.text {
		font-size: 14px;
		margin-top: 5px;
	}

	.grid-item-box {
		flex: 1;
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: column;
		align-items: center;
		justify-content: center;
		padding: 15px 0;
	}

	.flex-item-box {
		display: flex;
		align-items: center;
	}

	.bottom-content {
		width: 100%;
		height: calc(env(safe-area-inset-bottom) + 90rpx);
		background-color: #FDFDFD;
		position: fixed;
		bottom: 0rpx;
		border-bottom: 2rpx solid #F5F5F5;
		box-shadow: 0px -15rpx 20rpx -10rpx #f4f4f4;
		padding: 0 15rpx;
	}

	.bottom-view {
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
	}

	.bottom-button {
		width: 100%;
		border: 0;
		display: flex;
		flex-direction: column;
		padding: 0;
		margin: 0;
		justify-content: center;
		background-color: #FDFDFD;
		align-items: center;
	}

	.bottom-button::after {
		border: none;
	}

	.content1 {
		width: 150rpx;
	}

	.content2 {
		width: 100%;
		margin: 0 20rpx;
	}

	.txt-yaoqiu-1 {
		margin-left: 10rpx;
	}

	.img-yaoqiu-1 {
		position: relative;
		// top: 10rpx;
	}

	.all_jobs {
		width: 100%;
		border-top: #e2e2e2 thin solid;
		padding-bottom: 150rpx;
	}

	.jobs_item {
		position: relative;
		width: 100%;
		background: #FFFFFF;
		margin-top: 12rpx;
		padding: 20rpx 35rpx 18rpx 35rpx;
	}

	.all_jobs .jobs_item .item_name_line {
		position: relative;
		height: 55rpx;
		line-height: 55rpx;
	}

	.all_jobs .jobs_item .item_name_line .item_name {
		display: block;
		float: left;
		height: 45rpx;
		line-height: 45rpx;
		text-decoration: none;
		color: #333333;
		font-size: 33rpx;
	}

	.all_jobs .jobs_item .item_name_line .item_wage {
		position: absolute;
		right: 2rpx;
		top: 50%;
		-webkit-transform: translate(0, -50%);
		transform: translate(0, -50%);
		color: #ffaf24;
		line-height: normal;
		font-size: 25rpx;
	}

	.all_jobs .jobs_item .item_some_line {
		position: relative;
		height: 55rpx;
		line-height: 55rpx;
		margin-bottom: 10rpx;
	}

	.all_jobs .jobs_item .item_some_line .item_some {
		height: 45rpx;
		line-height: 45rpx;
		color: #666666;
		font-size: 27rpx;
	}

	.all_jobs .jobs_item .item_some_line .item_date {
		position: absolute;
		right: 2rpx;
		top: 0;
		height: 45rpx;
		line-height: 45rpx;
		color: #999999;
		font-size: 23rpx;
	}

	.location {
		display: flex;
		align-items: center;
	}

	.location image,
	.yaoqiu image {
		margin-right: 10rpx;
		width: 32rpx;
		height: 32rpx;
	}

	.yaoqiu-all {
		display: flex;
		flex-direction: row;
		flex-wrap: wrap;
	}

	.yaoqiu {
		display: flex;
		margin-right: 35rpx;
		align-items: center;
	}

	.all_jobs .jobs_item .split_line {
		width: 100%;
		border-bottom: 1rpx solid #e2e2e2;
		margin: 10rpx 0rpx 20rpx 0rpx;
	}
</style>